﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SRF.Data.Cfg
{
    /// <summary>
    /// 
    /// </summary>
    public class Dictionary : Dictionary<string, string>
    {
        public string this[string key]
        {
            get { return Get<string>(key); }
        }
        public T Get<T>(string key, T @default = default(T))
        {
            if (Keys.Contains(key))
            {
                return (T)Convert.ChangeType(base[key], typeof(T));
            }
            else
            {
                if (@default != null)
                {
                    return @default;
                }
                else
                {
                    throw new System.Collections.Generic.KeyNotFoundException(string.Format("{0}不存在", key));
                }
            }
        }
    }
}